package com.lianbang.staff.http.intercept

import cn.ubest.mvvmcore.utils.SpUtils
import com.lianbang.staff.util.LoginUtils
import okhttp3.Interceptor
import okhttp3.Response
import java.io.IOException

/**
 * Created by maoqi on 2020/9/22.
 */
/**
 * 头部添加的参数
 * Created by maoqi on 2018/7/12.
 */
class HeaderIntercept : Interceptor {
    @Throws(IOException::class)
    override fun intercept(chain: Interceptor.Chain): Response {
        val original = chain.request()
        val builder = original.newBuilder()

        //Token
        builder.header("token", LoginUtils.mToken ?: "")
//        builder.header(
//            "token",
//            "892ffb15d2ef1c4bead38188ca0857605dbfa4ecaa439a1cec6c79a75933571ab7af2716bfba6ee250b0b7931cac25617efba313dc3c5252c06f6bd5454bc7a0"
//        )
        return chain.proceed(builder.build())
    }
}